package com.sun.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

@Controller
public class JDBCController {

    @Autowired
    JdbcTemplate jdbcTemplate;



    @RequestMapping("/emps11")
    public String list(Model model){
        String sql = "select * from university.university ";
        String sql1 = "SELECT *  FROM university.university LIMIT 1 ";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list1 = jdbcTemplate.queryForList(sql1);
        System.out.println(list);
        model.addAttribute("emps",list);
        model.addAttribute("emps1",list1);
        return "emp/list1";
    }

}
